ODFx is a sample part that does multi-colored background images. The Metrowerks Code Warrior PPC project is included for reference.
This folder contains:
- ODFx: The OpenDoc Part. Install this file in your Editors folder
- Sources: All the non-ODF sources used to build ODFx.
- CWPPCDebug: The Metrowerks Code Warrior PPC project
- ODFx Stationery: Copy this file to your Stationery folder
- Documents: Contains some completely arbitrary samples.
-----
Brief Instructions:
ODFx uses one menu which contains the following menu items:
4 Nodes:
9 Nodes:
Determine how many colors ODFx uses to create the gradient image.
Zone Lines:
Shows or hides lines indicating the boundaries of the color zones in the image. Using 4 Nodes results in 4 zones, 9 nodes results in 9 zones. Double-Click within a color zone to change the color of its corresponding node. Zone Lines appear only on screen -- the lines are not drawn into exported pictures.
Chunky Resolution:
Good Resolution:
Fine Resolution:
Determines the number of interpolation steps between colors. Chunky uses 64 steps. Good uses 128 steps. Fine uses 256 steps. Calculating the image at Fine resolution can take a few seconds, even on a Power Macintosh, and the results are worth the time and memory usage only if the resulting image will cover a large area. The default resolution is "Good."
Rotate Colors:
Rotates the color nodes clockwise. In the 9 Node image, the center does not move.
-----
Miscellaneous Notes:
ODFx supports drag and drop.
ODFx generates a 24-bit offscreen image (using FW_CBitmap) and uses the FW_CColor::Blend() method to interpolate the colors for the image. It then creates a picture (FW_CPicture) of this image, and draws it to the screen. The dimensions of the internal image depend on the number of interpolation steps. 64 steps yields a 64x64 pixel image, and 256 steps yields a 256x256 pixel image. The resulting picture is cached, and is updated only when the parameters change, so once the image is calculated, updates are much faster. The picture is created using dithering, so it may be scaled to any desired size. There is no indication when the image is being recalculated, and for the "Fine" resolution images, the drawing may take a few seconds. There's not always a big difference between Good and Fine: use Fine prudently.
When an ODFx image is copied or exported, it will appear as a small square picture which can be scaled.
Other than the usage of the ditherCopy transfer mode when creating the FW_CPicture, this code should be cross platform.